package tool;

import java.util.Random;

public class Generator {

	public static String getString()
	{
		long currentTimestamp = System.currentTimeMillis();
        Random random = new Random(currentTimestamp);

        // 生成10到13位的随机数
        long randomNumber = generateRandomNumber(random, 10, 13);

      return String.valueOf(randomNumber);
	}
    public static String getString(int i)
    {
        long currentTimestamp = System.currentTimeMillis();
        Random random = new Random(currentTimestamp);

        // 生成10到13位的随机数
        long randomNumber = generateRandomNumber(random, i, i);

        return String.valueOf(randomNumber);
    }
	private static long generateRandomNumber(Random random, int minLength, int maxLength) {
        // 生成长度在[minLength, maxLength]范围内的随机数
        int length = minLength + random.nextInt(maxLength - minLength + 1);

        // 生成随机数
        long randomNumber = 0;
        for (int i = 0; i < length; i++) {
            randomNumber = randomNumber * 10 + random.nextInt(10);
        }

        return randomNumber;
    }
}
